<?php

define("DB_DRIVER_DEBUG", 0);

cload("database.dbrow");

abstract class DBAbstract {
    protected $dbh;
    protected $sth;
    protected $q;

    public function __construct() {
        if(!$this->connect()) {
            throw new Exception("DB Subsystem: error to connect to db");
        }
    }

    abstract public function connect();         // Подключение к БД
    abstract public function querysql($sql);    // Выполнение запроса
    abstract public function raw_fetch_array($sth=null);        // Возвращает строку данных в виде обьекта
    abstract public function quote_tbl();
    abstract public function quote_fld();

    public function query($q) {
        $sth = $this->querysql($q->__toString());
        $this->q = $q;

        return $sth;
    }

    public function fetch_array($sth=null) {
        return $this->raw_fetch_array($sth);
    }

}
?>
